home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
dir
/
dum2
/
src
/
view.mod
< prev
next >
Wrap
Text File
|
1987-05-28
|
1KB
|
50 lines
MODULE View;
(* This is a wuickie to allow you to use DuTypefile for viewing
and printing (both in ascii and hexdump) of files
see below for usage format. It is only about 6k when compiled
and I needed a hexdump print function.
*)
(*$S-*)(*$T-*)(*$A+*)
FROM DuTypefile IMPORT DisplayASCII,DisplayHex;
FROM CommandLine IMPORT GetCL,MaxCLength,CLStrings;
FROM Terminal IMPORT WriteString,WriteLn;
VAR
i,
args : CARDINAL;
argv : ARRAY[0..2] OF CLStrings;
s,p : CHAR;
Scrn,
Hex : BOOLEAN;
(* quickie to test the display formats *)
(* view filename [h][p] or view filename [p][h] *)
BEGIN
IF GetCL(args,argv) THEN END;
IF args > 0 THEN
IF args = 1 THEN
s := 0C;
p := 0C;
ELSIF args > 1 THEN
s := CAP(argv[1][0])
END;
IF args > 2 THEN
p := CAP(argv[2][0])
END;
Scrn := NOT((p = "P") OR (s = "P"));
Hex := (p = "H") OR (s = "H");
i := 0;
IF Hex THEN
DisplayHex(argv[0],Scrn)
ELSE
DisplayASCII(argv[0],Scrn)
END
ELSE
WriteLn;WriteString("USAGE: view filename [h][p]");WriteLn;
WriteString(" where h= hex p= prt:");WriteLn;
END
END View.